home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / LDB171.ARJ / EXAMP504.CPP < prev    next >
Text File  |  1992-05-12  |  752b  |  32 lines

  1.      // examp504.cpp - link with strbdr.obj and binder.obj
  2.      // rework of examp503.cpp
  3.  
  4.      #define sfile "examp504.txt"
  5.  
  6.      #include <string.h>
  7.      #include <fstream.h>
  8.      #include "strbdr.hpp"
  9.  
  10.      main()
  11.      {
  12.        StrBdr sb(BDR_DDELETE | BDR_DNEW | BDR_DSTORE);
  13.  
  14.        sb.ins(strdup("line one"));
  15.        sb.insNew("line two");
  16.        ofstream os(sfile);
  17.        if (!os)  return 1;
  18.        os << sb;
  19.        os.close();
  20.  
  21.        StrBdR sB;
  22.        ifstream is(sfile);
  23.        if (!is) return 1;
  24.        is >> sB;
  25.        is.close();
  26.        if (!sB)  return 1;
  27.        sB->setCurNode();      // reset current node
  28.        while (sB->next())  cout << (char *)*sB << "\n";
  29.        delete sB;
  30.        return 0;
  31.      }
  32.